﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SYH.Public.BLL
{
    public class Public_MessageCount
    {
        private static readonly SYH.Public.DAL.Public_MessageCount dal = new DAL.Public_MessageCount();

        #region 根据userid和count修改已读未读数
        /// <summary>
        /// 根据userid和count修改已读未读数
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="count"></param>
        /// <returns></returns>
        public static int UpdateMsgCount(int userid, int count)
        {
            int result = dal.UpdateMsgCount(userid, count);
            
            GetNoReadReceivedMessage(userid);
            return result;
        }
        #endregion

        #region 根据userid读收件箱中未读消息数
        /// <summary>
        /// 根据userid读收件箱中未读消息数
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public static int GetNoReadReceivedMessage(int userId)
        {
            int count = dal.GetNoReadReceivedMessage(userId);
               
            return count;
        }
        #endregion

        #region 根据消息类型获取未读消息数
        /// <summary>
        /// 根据消息类型获取未读消息数
        /// </summary>
        /// <param name="UserId"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public static int GetNoReadCountByType(int UserId, string type)
        {
            int count = dal.GetNoReadCountByType(UserId, type);

            return count ;
        }
        #endregion
    }
}
